<?php defined('ROOT_DIR') or die('Access denied!');?>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="content-type" content="text/html" />
	<meta name="author" content="暮雨秋晨" />
	<meta charset="UTF-8" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
    <meta name="description" content="<?php echo $config['desc'];?>" />
    <meta name="keywords" content="<?php echo $config['keywd'];?>" />
	<title><?php echo $title;?></title>
    <link rel="stylesheet" href="/Application/static/css/main.css" />
    <script src="/Application/static/js/common.js"></script>
</head>
<body>

<!-- header -->
<header>
<ul>
<li><a href="/" style="z-index: 50;">首页</a></li>
<li><a href="#" style="z-index: 49;">查看主题</a></li>
</ul>
</header>
<hr style="clear: both;height: 2px;margin: 0;padding: 0;" />

<!-- body -->
<div id="main">

<h1 style="text-align: center;font-size: 2em;"><?php echo $topic['title'];?></h1>

<div style="text-align: center;margin: 3px auto;padding: 1px;font-size: 14px;">发表时间：<?php echo date('Y-m-d H:i:s',$topic['ptime']);?></div>


<div id="box" style="text-indent: 2em;padding: 3px;">
<?php echo nl2br($topic['content']);?>
</div>

<div id="subtitle">回复列表</div>
<div id="box">
<?php if(empty($replys)):?>
<div id="tip">没人回复？赶紧抢沙发！</div>
<?php else:?>
<table>
<?php foreach($replys as $reply):?>
<tbody style="border-bottom: 1px dashed #eee;margin: 0.5em;display: block;">
<tr><th style="font-size: 18px;text-align: left;"><?php echo $this->getUserByID($reply['uid']);?></th><td style="font-size: 12px;"><?php echo date("Y-m-d H:i:s",$reply['ptime']);?></td></tr>
<tr><td colspan="2"><?php echo nl2br($reply['content']);?></td></tr>
</tbody>
<?php endforeach;?>
</table>
<?php endif;?>
</div>

<div id="box">
<?php if($login_user):?>
<form action="<?php echo $this->urlCreate('topic','reply',array('id'=>$topic['id']));?>" method="post">
<textarea name="content" style="display: block;word-wrap: break-word;overflow-x: hidden;overflow-y: auto;min-width: 80%;min-height: 80px;max-width: 650px;outline: none;padding: 3px;resize: none;margin: 0.5em auto;" placeholder="回复" maxlength="255"></textarea>
<input type="submit" name="submit" value="回复" style="display: block;width: 6em;margin: 6px auto;height: 3em;" />
</form>
<?php else:?>

<p style="color: #EE7700;text-align: center;">您未登录，无权回复。请<a href="<?php echo $this->urlCreate('user','login');?>">登录</a>/<a href="<?php echo $this->urlCreate('user','register');?>">注册</a>后回复。</p>

<?php endif;?>
</div>
</div>

<!-- footer -->
<footer>
&copy;<a href="http://www.doubear.com">Doubear</a> Driven by <a href="http://www.domvc.com">DoMVC</a> framework
</footer>
</body>
</html>